﻿using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using HtmlAgilityPack;
namespace DMOZ
{
   public sealed class Util
    {
       public static string getArea(string _url)
       {
              string url = @"http://ip138.com/ips.asp?" +  "ip=" + _url;
              string result = ""; ;
              try
              {
                  HtmlWeb webClient = new HtmlWeb();
                  webClient.DefaultEncoding = Encoding.GetEncoding("gb2312");
                  HtmlAgilityPack.HtmlDocument doc = webClient.Load(url);

             
                  HtmlNode node = doc.DocumentNode.SelectSingleNode("/html[1]/body[1]/table[1]/tr[3]/td[1]/ul[1]/li[1]");
                  if (node != null)
                  {
                      result = node.InnerText ;
                  }
                  
                  
                  doc = null;
                  
                  webClient = null;
              }
              catch (Exception error)
              {
                  throw;
              }
              return result;

                
       }
    }
}
